<template>
    <div>
        <!-- 面包屑导航区 -->
        <el-breadcrumb separator-class="el-icon-arrow-right">
            <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item>权限管理</el-breadcrumb-item>
            <el-breadcrumb-item>权限列表</el-breadcrumb-item>
        </el-breadcrumb>

        <!-- 、卡片视图区 -->
        <el-card>
            <el-table :data="rightslist" border stripe>
                <el-table-column type="index" label="#"></el-table-column>
                <el-table-column label="权限名称" prop="authName"></el-table-column>
                <el-table-column label="路径" prop="path"></el-table-column>
                <el-table-column label="权限等级" prop="level">
                    <template slot-scope="scope">
                        <el-tag v-if="scope.row.level=='0'">权限一</el-tag>
                        <el-tag type="success" v-else-if="scope.row.level=='1'">权限二</el-tag>
                        <el-tag type="warning" v-else-if="scope.row.level=='2'">权限三</el-tag>
                    </template>
                </el-table-column>
            </el-table>
            <!-- 分页区域 -->
            <!-- <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                :current-page="queryInfo.pagenum" :page-sizes="[1, 2, 3, 5, 10]" :page-size="queryInfo.pagesize"
                layout="total, sizes, prev, pager, next, jumper" :total="total">
            </el-pagination> -->
        </el-card>
    </div>
</template>

<script>
export default {
    data() {
        return {
            rightslist: [],
            total: 0,
            // 获取用户列表的参数对象
            queryInfo: {
                query: "",
                // 当前的页数
                pagenum: 1,
                // 当前每页显示多少条数据
                pagesize: 2,
            },
        }
    },
    created() {
        this.getRigthList()
    },
    methods: {
        async getRigthList() {
            const { data: res } = await this.$http.get('rights/list',{params:this.queryInfo})
            if (res.meta.status !== 200) {
                this.$message.error("获取权限列表数据失败")
            }
            this.rightslist = res.data
            console.log(this.rightslist);
        },
        // // 监听pageSize 改变事件
        // handleSizeChange(newSize) {
        //     this.queryInfo.pagesize = newSize;
        //     this.getRigthList();
        // },
        // // 监听 页码值 改变事件
        // handleCurrentChange(newPage) {
        //     // console.log(newPage);
        //     this.queryInfo.pagenum = newPage;
        //     this.getRigthList();
        // },
    }

}
</script>

<style>
</style>